package com.javacore.day14.awt;

import java.awt.Frame;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;


public class SimpleExample extends Frame implements WindowListener{

    public SimpleExample() {
        
       setTitle("Simple example");
       setSize(300, 200);
       setLocationRelativeTo(null);
       addWindowListener(this);
    }
    
    
    public static void main(String[] args) {
        
        SimpleExample ex = new SimpleExample();
        ex.setVisible(true);
    }

    /** WindowEvent handlers */
    // Called back upon clicking close-window button
    @Override
    public void windowClosing(WindowEvent e) {
       System.exit(0);  // terminate the program
    }

    @Override
	public void windowOpened(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosed(WindowEvent e) {
		// TODO Auto-generated method stub
		//System.exit(0);  // terminate the program
		
	}

	@Override
	public void windowIconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeiconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowActivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeactivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}
}